package br.com.unb.provenance.entities;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name = "Agent")
public class Agent extends Provenance {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id")
	private Integer id;
	
	@Column(name = "institution")
	private String institution;
	
	@Column(name = "function")
	private String function;
	
	@Column(name = "participating_institution")
	private String participating_instituion;
	
	@Column(name = "experiment_function")
	private String experiment_function;
	
	@Column(name = "annotation")
	private String annotation;
	
	@OneToOne
	@JoinColumn(name = "id_group")
	private Group group;
	
	@ManyToMany(cascade = CascadeType.ALL)
	@JoinTable(name = "project_agent", 
		joinColumns = { @JoinColumn(name = "id_project") }, 
		inverseJoinColumns = { @JoinColumn(name = "id_agent") })
	private List<Project> projects;
 
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getInstitution() {
		return institution;
	}

	public void setInstitution(String institution) {
		this.institution = institution;
	}

	public String getFunction() {
		return function;
	}

	public void setFunction(String function) {
		this.function = function;
	}

	public String getParticipating_instituion() {
		return participating_instituion;
	}

	public void setParticipating_instituion(String participating_instituion) {
		this.participating_instituion = participating_instituion;
	}

	public String getExperiment_function() {
		return experiment_function;
	}

	public void setExperiment_function(String experiment_function) {
		this.experiment_function = experiment_function;
	}

	public String getAnnotation() {
		return annotation;
	}

	public void setAnnotation(String annotation) {
		this.annotation = annotation;
	}

	public Group getGroup() {
		return group;
	}

	public void setGroup(Group group) {
		this.group = group;
	}
	
	

}
